package cn.darkhorse.device.iot.bo;

import cn.darkhorse.device.pojo.MesDevice;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;

import java.time.LocalDate;
import java.util.List;

/**
 * 设备监控数据，包含实时数据
 */
@Data
public class DeviceVO {
    private Long id;
    private String gatewayDeviceId;
    private Boolean deviceOnline;
    private String name;
    private String model;
    private Long type;
    private Long dept;
    private String pictures;
    private String code;
    private String companyName;
    private LocalDate leaseEndDate;
    private LocalDate leaseStartDate;
    private List<RealDataDetailVO> realDataList;
    private List<MesDevice> children;

    /**
     * 设备状态，多个状态用英文逗号隔开
     */
    private String status;

    public void addStatus(String newStatus) {
        if (StringUtils.isEmpty(newStatus)) {
            return;
        }

        if (StringUtils.isEmpty(this.status)) {
            this.status = newStatus;
        }else {
            this.status = this.status + "," + newStatus;
        }
    }
}
